package com.qfedu.entity.course05;

import java.util.HashMap;

public class SearchSystem {
    static HashMap<String, Integer> map = new HashMap<>();

    public static void main(String[] args) {
        System.out.println(search("劳动节"));
        System.out.println(search("乌克兰"));
        System.out.println(search("疫情"));
        System.out.println(search("劳动节"));
        System.out.println(search("劳动节"));
    }

    public static int search(String key) {
        Integer count = map.get(key);
        if (count != null) {
            count += 1;
        } else {
            count = 1;
        }
        map.put(key, count);
        return count;
    }
}
